package client;

import exceptions.LoadConfigException;

import java.io.InputStream;
import java.util.Properties;

public class Configuration {
	private String logFileName;
	private String labIP;
	private String loginsPath;
	private String targetPath;
	private String serverIP;
	private int serverPort;
	public Configuration() {
	}
	public static Configuration configure() throws LoadConfigException{
		InputStream in = Configuration.class.getResourceAsStream("/config.properties");
		Properties props = new Properties();
		try {
			props.load(in);
			in.close();
		} catch (Exception e) {
			e.printStackTrace();
			throw new LoadConfigException(e);
		}
		
		Configuration cfg= new Configuration();
		cfg.setLabIP(props.getProperty("labIP"));
		cfg.setLogFileName(props.getProperty("logFileName"));
		cfg.setTargetPath(props.getProperty("targetPath"));
		cfg.setLoginsPath(props.getProperty("loginsPath"));
		cfg.setServerIP(props.getProperty("serverIP"));
		cfg.setServerPort(Integer.parseInt(props.getProperty("serverPort")));
		return cfg;
	}
	public String getLabIP() {
		return labIP;
	}
	public void setLabIP(String labIP) {
		this.labIP = labIP;
	}
	public String getLogFileName() {
		return logFileName;
	}
	public void setLogFileName(String logFileName) {
		this.logFileName = logFileName;
	}
	public String getLoginsPath() {
		return loginsPath;
	}
	public void setLoginsPath(String loginsPath) {
		this.loginsPath = loginsPath;
	}
	public String getTargetPath() {
		return targetPath;
	}
	public void setTargetPath(String targetPath) {
		this.targetPath = targetPath;
	}
	public String getServerIP() {
		return serverIP;
	}
	public void setServerIP(String serverIP) {
		this.serverIP = serverIP;
	}
	public int getServerPort() {
		return serverPort;
	}
	public void setServerPort(int serverPort) {
		this.serverPort = serverPort;
	}
	
}
